開啟新文件

不工作,版本問題?

impl=document.implementation
doc=impl.createHTMLDocument()
doc.open()

直接在目前的視窗中,開啟空白文件:

document.open()
document.write("<h1>hello</h1>")

開啟新視窗,然後顯示文件

HTMLstring="<p style='color:red'>hello </p>"
newwindow=window.open();
newdocument=newwindow.document;
newdocument.write(HTMLstring);
//newdocument.close();

在新視窗列出連結

nlist = document.links
newwindow=window.open();
newdocument=newwindow.document;
for (var i=0;i<nlist.length;i++)
{
newdocument.write(nlist[i].outerHTML)
}